#ifndef	__SCREEN_H__
#define	__SCREEN_H__

#include "stm32f10x.h"
#include "lcd.h"
#include "key.h"

#define 	SIZE_ONE 		1
#define 	SIZE_TWO 		2
#define 	SIZE_THREE 		3
#define 	SIZE_FOUR 		4
#define 	SIZE_FIVE 		5
#define 	SIZE_SIX 		6
#define 	SIZE_SEVEN 		7
#define 	SIZE_EIGHT 		8

enum{
	DEVICE_START_INIT = 0,
	
	DEVICE_START_SHOW_TIME,
	DEVICE_START_DELAY_INFO,
	DEVICE_START_LINE_INFO,
	DEVICE_START_CHANNEL_INFO,
	DEVICE_START_KEY_INFO,
	
	DEVICE_PAGE_MAIN,
	DEVICE_PAGE_MENU_MAIN,
	DEVICE_PAGE_MENU_PARAM_QUERY,
	DEVICE_PAGE_MENU_PARAM_SET,
	DEVICE_PAGE_MENU_DISABLE_CHANNEL,
	
	DEVICE_PAGE_MENU_DISABLE_CHANNEL_INFO,
	DEVICE_PAGE_MENU_REMOTE_CALIBRATION,
	DEVICE_PAGE_MENU_REMOTE_CALIBRATION_INFO,
	DEVICE_PAGE_MENU_SYSTEM_EVENT,
	DEVICE_PAGE_MENU_WARNING_EVENT,
	
	DEVICE_PAGE_MENU_CHANNEL_INFO,
	DEVICE_PAGE_MENU_LINE_INFO,
	DEVICE_PAGE_SYSTEM_PARAM,
	DEVICE_PAGE_STORE_STATUS,
	DEVICE_CHANNEL_INFO,
	
	SYSTEM_PARAM_DELAY_TIME,
	SYSTEM_PARAM_PATROL_SCREEN_CUTTING,
	SYSTEM_PARAM_TIME_DATE,
	SYSTEM_PARAM_COMPUTER_COMMUNICATION,
	SYSTEM_PARAM_SET_MENU_CHANNEL,
	
	SYSTEM_PARAM_SET_MENU_LINE,
	SYSTEM_PARAM_SET_MENU_SYSTEM_PARAM,
	SYSTEM_PARAM_SET_MENU_CLEAR_EVENT,
	SYSTEM_PARAM_SET_MENU_CHANGE_PASSWORD,
	SYSTEM_PARAM_SET_MENU_DEBUG_SETTING,
	
	SYSTEM_PARAM_SET_MENU_CHANNEL_INFO,
	SYSTEM_PARAM_SET_DELAY_TIME,
	SYSTEM_PARAM_SET_PATROL_SCREEN_CUTTING,
	SYSTEM_PARAM_SET_TIME_DATE,
	SYSTEM_PARAM_SET_COMPUTER_COMMUNICATION,
	
	INPUT_SELECT,
	INPUT_SELECT_HZ,
	INPUT_SELECT_NUM,
	INPUT_SELECT_EN_UPPER,
	INPUT_SELECT_SYMBOL,
	INPUT_SELECT_EN_LOWER,
};

enum{
	DEVICE_CHANNEL_ONE = 0,
	DEVICE_CHANNEL_TWO,
	DEVICE_CHANNEL_THREE,
	DEVICE_CHANNEL_FOUR,
	DEVICE_CHANNEL_FIVE,
	DEVICE_CHANNEL_SIX,
	DEVICE_CHANNEL_SEVEN,
	DEVICE_CHANNEL_EIGHT,
};

enum{
	MENU_CH0 = 0,
	MENU_CH1,
	MENU_CH2,
	MENU_CH3,
	MENU_CH4,
	MENU_CH5,
};

enum{
	MAIN_TYPE_ONE = 0,
	MAIN_TYPE_TWO,
	MAIN_TYPE_THREE,
};

enum{
	CHN_INFO_TYPE_ZERO 	= 0,
	CHN_INFO_TYPE_ONE = 1,
	CHN_INFO_TYPE_TWO,
	CHN_INFO_TYPE_THREE,
	CHN_INFO_TYPE_FOUR,
};

typedef struct {
    uint8_t	layer;
    uint8_t layerTwo;
    uint8_t layerThree;
} Screen;


extern uint8_t c_Menu;

void new_page(void);
void page_init(void);
uint8_t show_process(uint16_t xStart,uint16_t yStart,uint8_t size,uint16_t xEnd);
void page_show_time(void);
void page_delay_info(void);
void page_line_info(void);
void page_channel_info(void);
void page_key_info(void);

void page_main_type_one(void);
void page_main_type_two(void);
void page_main_type_three(void);

void main_ch_clear(void);
void main_ch_add(void);
void main_ch_dec(void);

void key_ch_clear(void);

int8_t getMainMenuIndex(void);

void main_menu_ch_clear(void);
void main_menu_ch_add(void);
void main_menu_ch_dec(void);
void main_menu_ch_first(void);
void main_menu_ch_last(void);
void main_menu(void);

int8_t get_param_query_menu_Index(void);

void param_query_menu_ch_clear(void);
void param_query_menu_ch_add(void);
void param_query_menu_ch_dec(void);
void param_query_menu_ch_first(void);
void param_query_menu_ch_last(void);
void param_query_menu(void);

int8_t get_param_set_menu_Index(void);

void param_set_menu_ch_clear(void);
void param_set_menu_ch_add(void);
void param_set_menu_ch_dec(void);
void param_set_menu_ch_first(void);
void param_set_menu_ch_last(void);
void param_set_menu(void);

uint8_t disable_channel_menu_Index(void);
void disable_channel_menu_ch_clear(void);
void disable_channel_menu_ch_add(void);
void disable_channel_menu_ch_dec(void);
void disable_channel_menu_ch_first(void);
void disable_channel_menu_ch_last(void);
void disable_channel_menu(void);

int8_t get_device_disable_channel_Index(void);
void device_disable_channel_ch_clear(void);
void device_disable_channel_ch_add(void);
void device_disable_channel_ch_dec(void);
void device_disable_channel_ch_first(void);
void device_disable_channel_ch_last(void);
void device_disable_channel_info(uint8_t chn);

uint8_t get_remote_calibration_menu_Index(void);
void remote_calibration_menu_ch_clear(void);
void remote_calibration_menu_ch_add(void);
void remote_calibration_menu_ch_dec(void);
void remote_calibration_menu_ch_first(void);
void remote_calibration_menu_ch_last(void);
void remote_calibration_menu(void);

int8_t get_device_remote_calibration_Index(void);
void device_remote_calibration_ch_clear(void);
void device_remote_calibration_ch_add(void);
void device_remote_calibration_ch_dec(void);
void device_remote_calibration_ch_first(void);
void device_remote_calibration_ch_last(void);
void device_remote_calibration_info(uint8_t chn);

int8_t get_menu_channel_info_Index(void);
void menu_channel_info_ch_clear(void);
void menu_channel_info_ch_add(void);
void menu_channel_info_ch_dec(void);
void menu_channel_info_ch_first(void);
void menu_channel_info_ch_last(void);

void menu_system_event_ch_clear(void);
void menu_system_event_ch_add(void);
void menu_system_event_ch_dec(void);
void menu_system_event_ch_first(void);
void menu_system_event_ch_last(void);

void menu_warning_event_ch_clear(void);
void menu_warning_event_ch_add(void);
void menu_warning_event_ch_dec(void);
void menu_warning_event_ch_first(void);
void menu_warning_event_ch_last(void);

void device_menu_channel_info(void);
int8_t get_param_query_menu_Index(void);
void param_query_menu_ch_clear(void);
void param_query_menu_ch_add(void);
void param_query_menu_ch_dec(void);
void param_query_menu_ch_first(void);
void param_query_menu_ch_last(void);

void menu_system_event_info(void);
void menu_warning_event_info(void);

void device_channel_info_clear(void);
void device_channel_info_one(uint8_t index);
void device_channel_info_two(uint8_t index);
void device_channel_info_three(uint8_t index);
void device_channel_info_four(uint8_t index);

void device_line_info_one(void);
void device_line_info_clear(void);

int8_t get_device_page_system_param_Index(void);
void device_page_system_param_ch_clear(void);
void device_page_system_param_ch_add(void);
void device_page_system_param_ch_dec(void);
void device_page_system_param_ch_first(void);
void device_page_system_param_ch_last(void);

void device_page_system_param(void);

void system_param_delay_info_clear(void);
void system_param_delay_info(void);

void system_param_patrol_screen_cutting_info_clear(void);
void system_param_patrol_screen_cutting_info(void);

void system_param_time_date_info_clear(void);
void system_param_time_date_info(void);

void system_param_computer_communication_info_clear(void);
void system_param_computer_communication_info(void);

void system_story_status_info_clear(void);
void system_story_status_info(void);

void system_param_set_menu_channel(void);
void system_param_set_menu_line(void);
void system_param_set_menu_system_param(void);
void system_param_set_menu_clear_event(void);

void system_param_set_menu_change_password(void);
void system_param_set_menu_debug_setting(void);

int8_t get_system_param_set_menu_channel_info_Index(void);
void system_param_set_menu_channel_ch_clear(void);
void system_param_set_menu_channel_ch_add(void);
void system_param_set_menu_channel_ch_dec(void);
void system_param_set_menu_channel_ch_first(void);
void system_param_set_menu_channel_ch_last(void);

void system_param_set_channel_info_clear(void);
void system_param_set_channel_info_one(uint8_t index);
void system_param_set_channel_info_two(uint8_t index);
void system_param_set_channel_info_three(uint8_t index);
void system_param_set_channel_info_four(uint8_t index);

void system_param_set_menu_line_ch_clear(void);
void system_param_set_menu_line_info(void);

int8_t get_system_param_set_menu_system_param_Index(void);
void system_param_set_menu_system_param_ch_clear(void);
void system_param_set_menu_system_param_ch_add(void);
void system_param_set_menu_system_param_ch_dec(void);
void system_param_set_menu_system_param_ch_first(void);
void system_param_set_menu_system_param_ch_last(void);

void system_param_set_clear_event_info_ch_clear(void);
void system_param_set_menu_clear_event_info(void);

void system_param_set_delay_info_clear(void);
void system_param_set_delay_info(void);
void system_param_set_patrol_screen_cutting_info_clear(void);
void system_param_set_patrol_screen_cutting_info(void);
void system_param_set_time_date_info_clear(void);
void system_param_set_time_date_info(void);
void system_param_set_computer_communication_info_clear(void);
void system_param_set_computer_communication_info(void);

void system_param_set_menu_change_password_clear(void);
void system_param_set_menu_change_password(void);

int8_t get_system_param_set_menu_debug_setting_Index(void);
void system_param_set_menu_debug_setting_ch_clear(void);
void system_param_set_menu_debug_setting_ch_add(void);
void system_param_set_menu_debug_setting_ch_dec(void);
void system_param_set_menu_debug_setting_ch_first(void);
void system_param_set_menu_debug_setting_ch_last(void);
void system_param_set_menu_debug_setting(void);

void input_select(uint16_t index);
uint8_t get_input_select_ch(void);
void set_input_select_ch(uint8_t ch);
int8_t get_input_select_Index(void);
void input_select_ch_clear(void);
void input_select_index_add(int8_t num);
void input_select_index_dec(int8_t num);

int8_t get_py_select_index(void);
void py_select_index_add(int8_t num);
void py_select_index_dec(int8_t num);

int8_t get_upper_select_index(void);
void upper_select_index_add(int8_t num);
void upper_select_index_dec(int8_t num);

int8_t get_lower_select_index(void);
void lower_select_index_add(int8_t num);
void lower_select_index_dec(int8_t num);

int8_t get_num_select_index(void);
void num_select_index_add(int8_t num);
void num_select_index_dec(int8_t num);

int8_t get_symbol_select_index(void);
void symbol_select_index_add(int8_t num);
void symbol_select_index_dec(int8_t num);
#endif /* __SCREEN_H__ */
